import java.lang.reflect.Method

object Test {

    @JvmStatic
    fun main(args: Array<String>) {
        Data1::class.java.allMethods("set").forEach {
            println(it)
        }
    }

    abstract class Data {

        fun setA0() {

        }

    }

    class Data1 : Data() {

        fun setA1() {

        }
    }


    fun Class<*>.allMethods(prefix: String = ""): MutableList<Method> {
        val listOf = mutableListOf<Method>()

        for (method in declaredMethods) {
            if (prefix.isEmpty() || method.name.startsWith(prefix)) {
                listOf.add(method)
            }
        }
        if (this.superclass != Any::class.java) {
            listOf += this.superclass.allMethods(prefix)
        }
        return listOf
    }

}